.class public final Llt/farmis/libraries/apps_promo/AppsPromoPrefs;
.super Ljava/lang/Object;
.source "AppsPromoPrefs.kt"


# instance fields
.field private final CAMPAIGN_ID:Llt/minvib/magicpreferences/MagicIntegerPreference;

.field private final DEFAULT_SET:Ljava/lang/String;

.field private final KEY_PROMO_SHOWN:Llt/minvib/magicpreferences/MagicBooleanPreference;

.field private final LAST_SHOWN_TIME:Llt/minvib/magicpreferences/MagicLongPreference;

.field private final OPENED_TIMES:Llt/minvib/magicpreferences/MagicIntegerPreference;

.field private final OPEN_COUNT:Llt/minvib/magicpreferences/MagicIntegerPreference;

.field private final SHARED_PREF_FILENAME:Ljava/lang/String;

.field private context:Landroid/content/Context;

.field private final sharedPrefs:Landroid/content/SharedPreferences;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 5

    const-string v0, "context"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 11
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    const-string p1, "apps_promo_shared_prefs"

    .line 13
    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->SHARED_PREF_FILENAME:Ljava/lang/String;

    .line 14
    iget-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->SHARED_PREF_FILENAME:Ljava/lang/String;

    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {p1, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object p1

    if-eqz p1, :cond_0

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->sharedPrefs:Landroid/content/SharedPreferences;

    const-string p1, "lt.farmis.libraries.apps-promo"

    .line 15
    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->DEFAULT_SET:Ljava/lang/String;

    .line 17
    new-instance p1, Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->DEFAULT_SET:Ljava/lang/String;

    const-string v3, "open_count"

    invoke-direct {p1, v0, v3, v2}, Llt/minvib/magicpreferences/MagicIntegerPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPEN_COUNT:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 18
    new-instance p1, Llt/minvib/magicpreferences/MagicBooleanPreference;

    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->DEFAULT_SET:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    const-string v3, "key_promo_show"

    invoke-direct {p1, v0, v3, v1}, Llt/minvib/magicpreferences/MagicBooleanPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;)V

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->KEY_PROMO_SHOWN:Llt/minvib/magicpreferences/MagicBooleanPreference;

    .line 19
    new-instance p1, Llt/minvib/magicpreferences/MagicLongPreference;

    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->DEFAULT_SET:Ljava/lang/String;

    const-wide/16 v3, 0x0

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    const-string v3, "last_shown_time"

    invoke-direct {p1, v0, v3, v1}, Llt/minvib/magicpreferences/MagicLongPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;)V

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->LAST_SHOWN_TIME:Llt/minvib/magicpreferences/MagicLongPreference;

    .line 20
    new-instance p1, Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->DEFAULT_SET:Ljava/lang/String;

    const-string v1, "opened_times"

    invoke-direct {p1, v0, v1, v2}, Llt/minvib/magicpreferences/MagicIntegerPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPENED_TIMES:Llt/minvib/magicpreferences/MagicIntegerPreference;

    .line 21
    new-instance p1, Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->DEFAULT_SET:Ljava/lang/String;

    const-string v1, "campaign_id"

    invoke-direct {p1, v0, v1, v2}, Llt/minvib/magicpreferences/MagicIntegerPreference;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)V

    iput-object p1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->CAMPAIGN_ID:Llt/minvib/magicpreferences/MagicIntegerPreference;

    return-void

    .line 14
    :cond_0
    invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V

    const/4 p1, 0x0

    throw p1
.end method


# virtual methods
.method public final getCampaignId()Ljava/lang/Integer;
    .locals 2

    .line 60
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->CAMPAIGN_ID:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-virtual {v0, v1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v0

    return-object v0
.end method

.method public final getLastShownTime()Ljava/lang/Long;
    .locals 2

    .line 56
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->LAST_SHOWN_TIME:Llt/minvib/magicpreferences/MagicLongPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-virtual {v0, v1}, Llt/minvib/magicpreferences/MagicLongPreference;->get(Landroid/content/Context;)Ljava/lang/Long;

    move-result-object v0

    return-object v0
.end method

.method public final getOpenCounter()I
    .locals 2

    .line 31
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPEN_COUNT:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-virtual {v0, v1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v0

    const-string v1, "count"

    .line 32
    invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    return v0
.end method

.method public final getOpenedTimes()Ljava/lang/Integer;
    .locals 2

    .line 54
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPENED_TIMES:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-virtual {v0, v1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object v0

    return-object v0
.end method

.method public final increaseOpenCounter()V
    .locals 3

    .line 36
    invoke-virtual {p0}, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->getOpenCounter()I

    move-result v0

    add-int/lit8 v0, v0, 0x1

    .line 38
    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPEN_COUNT:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v2, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    invoke-virtual {v1, v2, v0}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    return-void
.end method

.method public final increaseOpenedTimeCounter()V
    .locals 3

    .line 42
    invoke-virtual {p0}, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->getOpenedTimes()Ljava/lang/Integer;

    move-result-object v0

    .line 43
    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    add-int/lit8 v0, v0, 0x1

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    .line 44
    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPENED_TIMES:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v2, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-virtual {v1, v2, v0}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    return-void
.end method

.method public final resetAllPref()V
    .locals 4

    .line 48
    invoke-virtual {p0}, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->resetOpenCounter()V

    .line 49
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->LAST_SHOWN_TIME:Llt/minvib/magicpreferences/MagicLongPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    const-wide/16 v2, 0x0

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Llt/minvib/magicpreferences/MagicLongPreference;->set(Landroid/content/Context;Ljava/lang/Long;)V

    .line 50
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPENED_TIMES:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    const/4 v2, 0x0

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    return-void
.end method

.method public final resetOpenCounter()V
    .locals 3

    .line 62
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->OPEN_COUNT:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    const/4 v2, 0x0

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    return-void
.end method

.method public final setCampaignId(I)V
    .locals 2

    .line 58
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->CAMPAIGN_ID:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object p1

    invoke-virtual {v0, v1, p1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    return-void
.end method

.method public final setLastShownTime(J)V
    .locals 2

    .line 65
    iget-object v0, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->LAST_SHOWN_TIME:Llt/minvib/magicpreferences/MagicLongPreference;

    iget-object v1, p0, Llt/farmis/libraries/apps_promo/AppsPromoPrefs;->context:Landroid/content/Context;

    invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object p1

    invoke-virtual {v0, v1, p1}, Llt/minvib/magicpreferences/MagicLongPreference;->set(Landroid/content/Context;Ljava/lang/Long;)V

    return-void
.end method
